
#ifndef _VECTOR3D_H_
#define _VECTOR3D_H_

#include "common.h"
#include "Point3D.h"

#include <iostream>
#include <cmath>

__BEGIN_NAMESPACE_DECL_

class Vector3D
{
    public:
        // Constructor: create a bounded vector given the components
        Vector3D (double i, double j, double k);
        // Constructor: create a vector as a directed line segment
        // from point p1 to p2
        Vector3D (Point3D p1, Point3D p2);
        // Constructor: create a vector as a directed line segment
        // from point (x1,y1,z1) to (x2,y2,z2).
        Vector3D (double x1, double y1, double z1, 
                  double x2, double y2, double z2);

        // Compute the cross product as a new vector from this vector
        // and another vector
        Vector3D cross (Vector3D other) const;
        // Compute the normalized cross product as a new vector from this vector
        // and another vector
        Vector3D crossN (Vector3D other) const;
        // Compute the scalar dot product from this vector and another
        double dot (Vector3D other) const;
        // Compute the normalized vector (unit length)
        Vector3D norm () const;
        // Compute the magnitude of the vector
        double magn () const;

        // accessors
        double i() const { return i_; }
        double j() const { return j_; }
        double k() const { return k_; }

    private:
        double i_, j_, k_;
};

// overload output operator as member function
std::ostream& operator<< (std::ostream& os, const Vector3D& vect);

__END_NAMESPACE_DECL_

#endif
